<?php

include "autoload.php";

//use \utils\Str;
//$ret = Str::formToJson("ret=0&err=tname-noexist");
//var_dump($ret);
//exit(0);

use \DesignPatterns\Creative\AbstractFactory\FactoryProducer;
use \DesignPatterns\Creative\AbstractFactory\AbstractFactory;
use \DesignPatterns\Creative\AbstractFactory\Shape;

/** @var $shapeFactory AbstractFactory */
$shapeFactory = FactoryProducer::getFactory("SHAPE");

/** @var $shape1 Shape */
$shape1 = $shapeFactory->getShape("CIRCLE");
$shape1->draw();

$shape2 = $shapeFactory->getShape("RECTANGLE");
$shape2->draw();

$shape3 = $shapeFactory->getShape("SQUARE");
$shape3->draw();

/** @var $colorFactory AbstractFactory */
$colorFactory = FactoryProducer::getFactory("COLOR");

$color1 = $colorFactory->getColor("RED");
$color1->fill();

$color2 = $colorFactory->getColor("GREEN");
$color2->fill();

$color3 = $colorFactory->getColor("BLUE");
$color3->fill();